package main

import (
	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"grpcDemo/go_client/proto/simple"
	"log"
)

const (
	// go gRPC 服务地址
	//Address = "0.0.0.0:9090"

	// java gRPC 服务地址
	Address = "0.0.0.0:9898"
)

func main() {
	conn, err := grpc.Dial(Address, grpc.WithInsecure())
	if err != nil {
		log.Fatalln(err)
	}
	defer conn.Close()

	// 初始化客户端
	c := simple.NewSimpleClient(conn)

	// 调用 SayHello 方法
	res, err := c.SayHello(context.Background(), &simple.HelloRequest{Name: "Hello World"})

	if err != nil {
		log.Fatalln(err)
	}

	log.Println(res.Message)

}
